Having a firm grasp on the ESP32 functions, I wanted to push the boundaries and connect up the wifi and bluetooth up with different nodes, specifically with my computer. This would be useful to remotely control my final 3 axis machine through a phone app, so that it provides a simple interface.
This week's assignments: (1.) design, build, and connect wired or wireless node(s)
with network or bus addresses For this week, I'm going to be utilizing the I2C connection and attempt to fully connect both architectures together.
[1] KICAD
My new PCB traces were based off of Zach's DVR breakout board design, with several modifications. This is version two of the circuit design that I will be documenting; the initial design does work, but had incoreect capacitor locations and was a bit too large. The first of which involves microstepping; nStep is pulled high as instructed, but the other M0/M1 ports are connected to the microprocessor so that the stepping can be directly changed in real time.
You can find more information on his GitLab here. I strongly suggest going through the basics of microstepping before this, as well as how to current limit with the resistors (which I eventually replace with a potentiometer).
Note a couple of items: The traces are mostly 0.4 cm, but are increased to 0.6 in areas where the ground is underneatt the pins necessary. This is to protect it and prevent peeling, which was a major issue.
[2] PCB Milling
After I exported and aligned the file for the traces, I was able to mill without a hitch! I made four of these boards, as well as 1 of the first version.
Left: Version A, Right: Version B. This is more stable and less prone to voltage spikes.
[3] PCB Testing
Uploading a blink program through my UPDI cable, we can tell that it works!
Using those connector pins, we can quickly plug this into a 12V power supply as well as the stepper motor through the 2 x 4 connector pin. Especially with the power supply, I found out that you can chain them together. As long as the voltage is within an acceptable amount (9V to 16V), the motors are happy and will take any supply of amperage that they need.
Now lets try getting the I2C together. As you can see here, the grounds have to be connected together to provide a reference frame, and I did that through a breakout board. Then I uploaded some code to
[4] Coding
ATTINY Stepper Motor Code (.ino).
To connect both the ESP32 and ATTINY together, I utilized the Wire Library to sync them up on I2C. I gave the receiver an address, and then made it wait for commands (in this case an integer) to trigger the action of future movement.
With a test circuit, we can sucessfully see the motor working as intended. One of the issues I faced initially was motor stalling, which could be either too high or too little resistance. In addition, one time I accidentally made stepper motor music because the pitch of the motors was too higher.
Here's the full connection working! Now that the intial concept has been verified, we can finish the rest of the breakout PCBs and fabricate them. This is major progress for my final project, and I now see the end of the tunnel!